import request from '@/utils/request';

/**
 * 分页查询订单流程状态
 */
export async function pageContainerBillProcess(params) {
  const res = await request.get('/order/containerBillProcess/page', { params });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 查询订单流程状态列表
 */
export async function listContainerBillProcess(params) {
  const res = await request.get('/order/containerBillProcess', {
    params
  });
  if (res.data.code === 0 && res.data.data) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 根据id查询订单流程状态
 */
export async function getContainerBillProcess(id) {
  const res = await request.get('/order/containerBillProcess/' + id);
  if (res.data.code === 0 && res.data.data) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 添加订单流程状态
 */
export async function addContainerBillProcess(data) {
  const res = await request.post('/order/containerBillProcess', data);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 修改订单流程状态
 */
export async function updateContainerBillProcess(data) {
  const res = await request.put('/order/containerBillProcess', data);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 删除订单流程状态
 */
export async function removeContainerBillProcess(id) {
  const res = await request.delete('/order/containerBillProcess/' + id);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
